package cn.itlaobing.service.impl;

import cn.itlaobing.dao.OrderDao;
import cn.itlaobing.exception.BusinessException;
import cn.itlaobing.model.OrderModel;
import cn.itlaobing.service.OrderService;
import cn.itlaobing.util.DateUtil;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/11/2.
 */
public class OrderServiceImpl implements OrderService {
    OrderDao orderDao=new OrderDao();


    public List<OrderModel> show(int userid)throws BusinessException  {

        List<OrderModel> list=new ArrayList<OrderModel>();

        try {
            list=orderDao.show(userid);
            for(OrderModel o:list){
                System.out.println(o.toString());
            }
        } catch (SQLException e) {
            e.printStackTrace();
            throw new BusinessException(e.getMessage());
        }

        return list;
    }
    public OrderModel payment(String userid) throws BusinessException {
        OrderModel orderModel=null;
        try {
            orderModel=orderDao.payment(userid);
        } catch (SQLException e) {
            e.printStackTrace();
            throw new BusinessException(e.getMessage());
        }
        return orderModel;
    }
}
